<style>
    .layui-fixbar {
        display: none !important;
    }
    
    .img-wrap {
        width: 80px;
        height: 80px;
        display: table-cell;
        vertical-align: middle;
        text-align: center;
        cursor: pointer;
    }
    
    .img-wrap img {
        width: 100%;
        height: 100%;
    }
    
    .img-wrap .layui-icon {
        font-size: 40px;
    }
</style>

<div class="layui-main" style="width:auto">
    <if condition="!$info['group_id']">
        <blockquote class="layui-elem-quote">当前未选择所属分类，无法执行编辑操作</blockquote>
    </if>
    <form class="layui-form callback shuaxin" action="{:U('edit_post')}" method="post" style="margin-top:20px;">

        <div class="layui-form-item">
            <label class="layui-form-label">*父节点：</label>
            <div class="layui-input-inline">
                <select name="parentid">
                    <option value="0" <if condition="$info['parentid'] eq 0">selected</if>>根节点</option>
                    {$select_categorys}
                </select>

            </div>
            <if condition="$info['id']">
                <span style="line-height:38px;color:red">当前分类ID：<b>{$info.id}</b></span>
            </if>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">*分类名称：</label>
            <div class="layui-input-inline">
                <input type="text" style="width:400px;" name="cat_name" value="{$info.cat_name}" placeholder="请输入分类名称" lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">*分类Key：</label>
            <div class="layui-input-inline">
                <input type="text" style="width:400px;" name="cat_desc" value="{$info.cat_desc}" placeholder="请输入分类Key" lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">分类图：</label>
            <div class="layui-input-block">
                <input type="text" id="fengmian" name="img" style="width:400px;display:inline-block" value="{$info.img}" placeholder="请输入封面图地址" class="layui-input">
                <a href="javascript:;" id="fengmianupload" class="layui-btn">上传图片</a>
                <div class="img-wrap" id="fengmian-box" style="background:#f8f8f8;text-align:center;">
                    <if condition="$info['img']">
                        <img src="{$info.img}">
                        <else/>
                        <span style="font-size:30px;line-height:80px;color:#eee;">封面</span>
                    </if>
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">图标：</label>
            <div class="layui-input-block">
                <input type="text" id="icon" name="icon" style="width:400px;display:inline-block" value="{$info.icon}" placeholder="" class="layui-input">
                <a href="javascript:think_open('/admin/cat/icons','设置图标',['674px','500px'],0);" id="seticon" class="layui-btn">设置图标</a>
                <div class="img-wrap" id="icon-box" style="background:#f8f8f8;text-align:center;">
                    <if condition="$info['icon']">
                        <i class="{$info.icon}"></i>
                    </if>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">排序值：</label>
            <div class="layui-input-inline">
                <input type="text" name="listorder" value="{$info.listorder|default=0}" placeholder="输入排序值" lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>


        <div class="layui-form-item">
            <div class="layui-input-block">
                <input type="hidden" name="id" value="{$info.id}">
                <input type="hidden" name="group_id" lay-verify="required" value="{$info.group_id}">
                <button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
            </div>
        </div>
    </form>

</div>

<script>
    layui.use(['jquery', 'catadmin'], function() {

    });

    //设置icon
    function callback(icon) {
        layui.use('jquery', function() {
            var $ = layui.jquery;
            $('#icon').val(icon);
            $('#icon-box').html('<i class="' + icon + '"></i>');
        });
    }
</script>